﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SpringGraph;
using SpringGraphExample.Entities;

namespace SpringGraphExample.Views
{
    public partial class GraphControls : UserControl
    {
        public GraphControls()
        {
            InitializeComponent();

            Graph g = new Graph();

            foreach (var entity in SampleEntities.SimpleEntities)
            {
                g.Add(new Item() { DataContext = entity });
            }

            g.Link(g.Nodes[0], g.Nodes[1]);
            g.Link(g.Nodes[1], g.Nodes[2]);
            g.Link(g.Nodes[2], g.Nodes[3]);
            g.Link(g.Nodes[3], g.Nodes[4]);

            g.Link(g.Nodes[0], g.Nodes[2]);

            Graph.DataProvider = g;
        }
    }
}
